package cate.common.table.fight.skill.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.table.d.GDSkill;
import cp.solution.util.str.Str;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.Data;

import java.util.List;

@NoteClass("技能-基础")
@Data
public class SkillBaseRow extends ERow {

	@NoteField("技能ID")
	public int tid;

	@NoteField("原型ID")
    public int protoId;

	@NoteField("技能类型")
    public byte type;

	@NoteField("技能定位")
	private String positionCode;

	@NoteField("增益技能")
	public boolean gain;

	@NoteField("物理技能特性")
	public boolean featurePhy;

	@NoteField("法术技能特性")
	public boolean featureMagic;

	@NoteField("技能名称")
    public String name;

	@NoteField ("技能等级")
	public int level;

	@NoteField("标签")
	public String tagCode;

	@NoteField("当前段数")
	public int curSegment;

	@NoteField("属性增加")
	public String attrCode;

	@NoteField("战斗属性")
	public String fightAttrStr;

	@NoteField("解锁回合")
	public int unlockRound;

	@NoteField("冷却回合")
	public int cd;

	@NoteField("释放优先级")
	public int usePriority;

	@NoteField("重选目标")
	public byte retarget;

	@NoteField("敌我目标")
	public byte tarScope;

	@NoteField("作用目标数")
	public int targetNum;

	@NoteField("特殊目标规则")
	public Byte cSpecial;

	@NoteField("作用职业")
	private String cJobCode;

	@NoteField("作用阵营")
	private String cCampCode;

	@NoteField("排序属性")
	public Integer cAttr;

	@NoteField("作用技能标签")
	private String cSkillTagCode;

	@NoteField("作用buff标签")
	private String cSkillBuffCode;

	@NoteField("主动效果类型")
	public String effectType;

	@NoteField("主动效果配置")
	public String effectCfgCode;

	@NoteField("施法者临时属性")
	private String casterTempAttrCode;

	@NoteField("主动脚本")
	public String activeScript;

	@NoteField("主动脚本参数")
	public String activeScriptArgs;

	@NoteField("被击临时属性")
	private String targetTemptAttrCode;

	@NoteField("被动脚本")
	public String passiveScript;

	@NoteField("被动脚本参数")
	public String passiveScriptArgs;

	@NoteField("buff添加规则")
	private String buffAddRuleCode;

	@NoteField("子技能ID")
	private String subIdCode;

	@NoteField("兄弟技能模式")
	public Byte brotherMode;

	@NoteField("兄弟技能配置")
	public String brotherCode;

	@NoteField("强化效果")
	private String enhanceCode;

	@NoteField("buff强化效果")
	private String buffEnhanceCode;

	@NoteField("被动buff")
	private String passiveBuffCode;

	@NoteField("开场技能")
	public int beginSkill;

	@NoteField("行动持续时间")
	public int actionTime;

	@NoteField("附加战力估值")
	public long powerExt;



    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
		this.id = xrw.getInteger("技能ID",0);
		this.tid = xrw.getInteger("技能ID",0);
        this.protoId = xrw.getInteger("原型ID", this.id);
        this.type = xrw.getByte("技能类型", GDSkill.Type.ACTIVE);


        this.positionCode = xrw.getString("技能定位",null);
        this.gain = xrw.getBoolean("增益技能",false);
        this.featurePhy  = xrw.getBoolean("物理技能特性",false);
        this.featureMagic  = xrw.getBoolean("法术技能特性",false);
        this.name = xrw.getString("技能名称备注");
        this.level = xrw.getInteger("技能等级",0);


        this.tagCode = xrw.getString("标签");
        this.curSegment = xrw.getInteger("当前段数", 1);
		this.attrCode = xrw.getString("属性增加");
		this.fightAttrStr = xrw.getString("战斗属性");


		this.unlockRound = xrw.getInteger("解锁回合", 0);
		this.cd = xrw.getInteger("冷却回合", 0);
		this.usePriority = xrw.getInteger("释放优先级", 0);

		this.retarget = xrw.getByte("重选目标", GDSkill.Retarget.NO_RETARGET);
		this.tarScope = xrw.getByte("敌我目标", GDSkill.Scope.DEFAULT);
		this.targetNum = xrw.getInteger("作用目标数", 0);
		this.cSpecial = xrw.getByte("特殊目标规则",GDSkill.CSpecial.NULL);

		this.cJobCode = xrw.getString("作用职业");
		this.cCampCode = xrw.getString("作用阵营");

		this.cAttr = xrw.getInteger("排序属性",null);
		this.cSkillTagCode = xrw.getString("作用技能标签",null);
		this.cSkillBuffCode = xrw.getString("作用buff标签",null);



		this.effectType = xrw.getString("主动效果类型", GDSkill.EffectType.无);
		this.effectCfgCode = xrw.getString("主动效果配置");

		this.casterTempAttrCode = xrw.getString("施法者临时属性");

		this.activeScript = xrw.getString("主动脚本");
		this.activeScriptArgs = xrw.getString("主动脚本参数");

		this.targetTemptAttrCode = xrw.getString("被击临时属性");

		this.passiveScript = xrw.getString("被动脚本");
		this.passiveScriptArgs = xrw.getString("被动脚本参数");

		this.buffAddRuleCode = xrw.getString("buff添加规则");


		this.subIdCode = xrw.getString("子技能ID");
		this.brotherMode = xrw.getByte("兄弟技能模式");
		this.brotherCode = xrw.getString("兄弟技能配置");
		this.enhanceCode = xrw.getString("强化效果");
		this.buffEnhanceCode = xrw.getString("buff强化效果");
		this.passiveBuffCode = xrw.getString("被动buff");
		this.beginSkill =xrw.getInteger("开场技能", -1);


		this.actionTime = xrw.getInteger("行动持续时间", 0);
		this.powerExt = xrw.getLong("附加战力估值",0L);
    }

	/** 技能定位 */
	public List<String> positions;
	/** 技能标签*/
	public List<String> tags;
	/** 作用职业*/
	public List<Byte> cJobs;
	/** 作用阵营*/
	public List<Byte> cCamps;
	/** 作用技能标签*/
	public List<String> cSkillTags;
	/** 作用buff标签*/
	public List<String> cBuffTags;

	/** 强化效果列表 */
	public List<Integer> enhanceList;
	/** buff强化效果列表 */
	public List<String> buffEnhanceList;

	/** 被动buff列表 */
	public List<String> passiveBuffs;

	/** buff添加规则 */
	public List<String> buffAddRules;

	/** 子技能id */
	public List<Integer> subSkills;

	/** 施法者临时属性 */
	public List<String> casterTempAttrs;
	/** 受击临时属性 */
	public List<String> targetTempAttrs;

	public void decode() {


		positions = Str.str2StrList(positionCode,"#");
		tags = Str.str2StrList(tagCode,"#");

		cJobs = Str.str2ByteList(cJobCode,"#");
		cCamps = Str.str2ByteList(cCampCode,"#");
		cSkillTags = Str.str2StrList(cSkillTagCode,"#");
		cBuffTags = Str.str2StrList(cSkillBuffCode,"#");

		enhanceList = Str.str2IntList(enhanceCode,"#");
		buffEnhanceList = Str.str2StrList(buffEnhanceCode, ",");

		passiveBuffs = Str.str2StrList(passiveBuffCode,"#");


		buffAddRules = Str.str2StrList(buffAddRuleCode, ",");
		subSkills = Str.str2IntList(subIdCode,"#");

		casterTempAttrs = Str.str2StrList(casterTempAttrCode, ",");
		targetTempAttrs = Str.str2StrList(targetTemptAttrCode, ",");
	}
}
